package com.ljh.account.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ljh.account.dao.Announcement;
import com.ljh.account.dao.BankPartner;
import com.ljh.account.mapper.BankPartnerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BankPartnerService {

    @Autowired
    private BankPartnerMapper bankPartnerMapper;

    public void addBankPartner(BankPartner bankPartner) {
        bankPartnerMapper.insertBankPartner(bankPartner);
    }

    public BankPartner getBankPartner(int id) {
        return bankPartnerMapper.selectBankPartnerById(id);
    }

    public List<BankPartner> getAllBankPartners() {
        return bankPartnerMapper.selectAllBankPartners();
    }

    public void updateBankPartner(BankPartner bankPartner) {
        bankPartnerMapper.updateBankPartner(bankPartner);
    }

    public void deleteBankPartner(int id) {
        bankPartnerMapper.deleteBankPartner(id);
    }

    public PageInfo getBankPartners(int page, int size) {
        PageHelper.startPage(page, size);
        List<BankPartner> list = bankPartnerMapper.selectBankPartners();
        return new PageInfo(list);
    }
}